package com.winning.devops.batch.listener.chunk;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.core.annotation.AfterChunk;
import org.springframework.batch.core.annotation.BeforeChunk;
import org.springframework.batch.core.scope.context.ChunkContext;

/**
 * chunk 监听器
 * 注解方式实现
 *
 * @author chensj
 * @date 2020-02-29 15:22
 */
public class FirstChunkExecutionListener {

    /**
     * logger
     */
    private static final Logger logger = LoggerFactory.getLogger(FirstChunkExecutionListener.class);

    @BeforeChunk
    public void beforeChunk(ChunkContext context) throws Exception {
        logger.info("FirstChunkExecutionListener listener step {} beforeChunk ",
                context.getStepContext().getStepName());
    }



    @AfterChunk
    public void afterChunk(ChunkContext context) throws Exception {
        logger.info("FirstChunkExecutionListener listener step {} afterChunk ", context.getStepContext().getStepName());
    }
}
